package com.heima.freemarker.controller;

import com.heima.freemarker.pojos.Student;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.Date;

@Controller
public class HelloController {

    @GetMapping("/basic")
    public String basic(Model model){
        model.addAttribute("name","黑马程序猴");

        // String数据
        model.addAttribute("name", "黑马程序员");

        //对象数据
        Student student = new Student();
        student.setAge(20);
        student.setBirthday(new Date());
        student.setMoney(9000F);
        student.setName("小明");
        model.addAttribute("stu", student);

        // 找到页面
        return "01-basic";
    }
}
